import request from "./request";

//获取博客分类
export async function getBlogType() {
	return await request.get("/api/blogtype");
}

//获取分页博客数据
export async function getBlog(page = 1, limit = 10, categoryid = -1) {
	return await request.get("/api/blog", {
		params: { page, limit, categoryid },
	});
}

//获取单个博客
export async function getoneBlog(id) {
	return await request.get(`/api/blog/${id}`);
}

//提交评论
export async function postComment(commentinfo) {
	return await request.post(`/api/comment`, {
		commentinfo,
	});
}

//分页获取评论
export async function getComments(page = 1, limit = 10, blogid = -1) {
	return await request.get(`/api/comment`, {
		params: {
			page,
			limit,
			blogid,
		},
	});
}
